import java.util.Scanner;

public class d329 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String input, output;
		String[] sp_input;
		char each_char;
		String sp_result;
		int n;
		int a;
		int b;
		int result_int;
		String result_string;
		
		while(sc.hasNext()) {
			input = sc.nextLine();
			n = Integer.parseInt(input);
			
			for(int i = 0; i < n; i++) {
				input = sc.nextLine();
				sp_input = input.split(" ");
				
				sp_result = "";
				for(int j = sp_input[0].length() - 1; j >= 0 ; j--) {
					each_char = sp_input[0].charAt(j);
					sp_result += each_char;
				}			
				sp_input[0] = sp_result;
				
				sp_result = "";
				for(int j = sp_input[1].length() - 1; j >= 0 ; j--) {
					each_char = sp_input[1].charAt(j);
					sp_result += each_char;
				}
				sp_input[1] = sp_result;
				
				
				a = Integer.parseInt(sp_input[0]);
				b = Integer.parseInt(sp_input[1]);
				
				result_string = Integer.toString( ( a + b ) );
				output = "";
				for(int j = result_string.length() - 1; j >= 0; j--) {
					each_char = result_string.charAt(j);
					output += each_char;
				}
				result_int = Integer.parseInt(output);
				output = Integer.toString(result_int);
				
				System.out.println(output);
			}
		}
	}
	
}